<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="Public/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="Public/Admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="Public/Admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="Public/Admin/Flat/img/favicon.ico">
	   	  	<!--上传插件开始-->
	   	<script src="Public/uploadify/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
	   	<script src="Public/uploadify/jquery.uploadify.min.js" type="text/javascript" charset="utf-8"></script>
	   	<link rel="stylesheet" type="text/css" href="Public/uploadify/uploadify.css"/>
	   	<!--上传插件引入结束-->
	   	<script src="Public/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
	   	<!--<script type="text/javascript">
			$(function(){
//				alert();
				$('#close_img').click(function(){
//					alert(1);
					var str='<label for="exampleInputEmail1">缩略图</label><input id="file" type="file" name="logo">';
					$('#img_box').html(str);
				})
			})
		</script>-->
	</head>
	<body>
		<form action="" method="post" enctype="multipart/form-data">
			
		<div class="alert alert-success">添加品牌</div>
		<div class="form-group">
			<label for="exampleInputEmail1">品牌名称</label>
			<input id="exampleInputEmail1" class="form-control" type="text" name="bname" value="{{$data['bname']}}">
		</div>
		
		<div class="form-group">
			
		<!--<div class="form-group" id="img_box">
			{{if value="$data['logo']"}}
				<img src="{{$data['logo']}}" style="width: 200;height: 200;" />
				<a href="javascript:;" id="close_img">X</a>
				<input type="hidden" name="logo" id="" value="{{$data['logo']}}" />
				
			{{else}}
				<label for="exampleInputEmail1">缩略图</label>
				<input id="file" type="file" name="logo">
			{{endif}}
		</div>
			-->
			<label for="exampleInputEmail1">缩略图</label>
				<input id="file" type="file" name="logo">
				<script type="text/javascript">
        $(function() {
            $('#file').uploadify({
                'formData'     : {//POST数据
                    '<?php echo session_name();?>' : '<?php echo session_id();?>',
                },
                'fileTypeDesc' : '上传文件',//上传描述
                'fileTypeExts' : '*.jpg;*.png',
                'swf'      : '{{__PUBLIC__}}/uploadify/uploadify.swf',
                'uploader' : '{{U('upload')}}',
                'buttonText':'选择文件',
                'fileSizeLimit' : '2000KB',
                'uploadLimit' : 10,//上传文件数
                'width':65,
                'height':25,
                'successTimeout':10,//等待服务器响应时间
                'removeTimeout' : 0.2,//成功显示时间
                'onUploadSuccess' : function(file, data, response) {
					//转为json
                    data=$.parseJSON(data);
                    //获得图片地址
                    var imageUrl = data.url;
                    var li="<li path='"+data.path+"' url='"+data.url+"'><img src='"+imageUrl+"' style='width:200px;' /><input type='hidden' name='logo' value='"+data.path+"'/></li>";
                    $("#uploadList ul").prepend(li);
                }
            });
        });
    </script>
		 <div id="uploadList">
	        <ul>
	
	        </ul>
	    </div>
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">排序</label>
			<input id="exampleInputEmail1" value="{{$data['sort']}}" class="form-control" type="text" name="sort">
		</div>
		<button class="btn btn-primary btn-block" type="submit"> 确定 </button>
		<input type="hidden" name="bid" id="bid" value="{{$data['bid']}}" />
		</form>
	</body>
</html>
